一起看[优].js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. function verifyLogin(key) {
  2. let cnt = 0;
  3. let cookie = '';
  4. let content = '';
  5. let yzm_url = 'https://www.cpldq.com/include/vdimgck.php';
  6. log(`验证码链接:${yzm_url}`);
  7. let submit_url = 'https://www.cpldq.com/search.php?scheckAC=check&page=1&searchtype=&order=&tid=&area=&year=&letter=&yuyan=&state=&money=&ver=&jq=';
  8. log(`post登录链接:${submit_url}`);
  9. while (cnt < OCR_RETRY) {
  10. try {
  11. let {cookie, html} = reqCookie(yzm_url + '?t=' + new Date().getTime(), {toBase64: true});
  12. let code = OcrApi.classification(html);
  13. let code1 = eval(code.slice(0, -1));
  14. log(`第${cnt + 1}次验证码识别结果:${code}->${code1}`);
  15. html = post(submit_url, {
  16. headers: {Cookie: cookie},
  17. body: 'validate=' + code1 + '&searchword=' + key,
  18. });
  19. if (/相关搜索结果/.test(html)) {
  20. content = html;
  21. return {cookie, html: content} // 需要返回cookie
  22. } else if (!/相关搜索结果/.test(html) && cnt + 1 >= OCR_RETRY) {
  23. cookie = ''; // 需要清空返回cookie
  24. }
  25. } catch (e) {
  26. log(`第${cnt + 1}次验证码提交失败:${e.message}`);
  27. if (cnt + 1 >= OCR_RETRY) {
  28. cookie = '';
  29. }
  30. }
  31. cnt += 1
  32. }
  33. return {cookie, html: content}
  34. }
  35. globalThis.verifyLogin = verifyLogin;
  36. var rule = {
  37. title: '一起看[优]',
  38. host: 'http://www.cpldq.com',
  39. url: '/cptype/fyclass-fypage.html',
  40. searchUrl: '/search.php?page=fypage&searchword=**&searchtype=',
  41. searchable: 0,
  42. quickSearch: 0,
  43. filterable: 1,
  44. filter: '',
  45. filter_url: '',
  46. headers: {
  47. 'User-Agent': 'MOBILE_UA',
  48. },
  49. timeout: 5000,
  50. class_parse: '.sb_login_alert_box&&li;a&&Text;a&&href;/(\\d+)\.html',
  51. cate_exclude: '',
  52. play_parse: true,
  53. lazy: $js.toString(() => {
  54. input = {parse: 1, url: input, js: ''};
  55. }),
  56. double: true,
  57. 推荐: '.main&&.bgte1130;ul&&.sb-film-one;*;*;*;*',
  58. 一级: '.sb-area-index&&ul&&.qcontainer;i&&Text;.lazy&&data-original;.other&&Text;a&&href',
  59. 二级: {
  60. title: '.name&&Text;.ct&&dd&&Text',
  61. img: '.lazy&&data-original',
  62. desc: '.ct&&dd:eq(1)&&Text;.ct&&dd:eq(2)&&Text;.ct&&dt:eq(2)&&Text;.ct&&dt&&Text;',
  63. content: 'div.ee&&Text',
  64. tabs: '.playfrom&&li',
  65. lists: '.playlist:eq(#id)&&ul&&li:not(:contains(滈凊))',
  66. tab_text: 'body--sup&&Text',
  67. list_text: 'body&&Text',
  68. list_url: 'a&&href'
  69. },
  70. //搜索: '*',
  71. 搜索: $js.toString(() => {
  72. let cookie = getItem(RULE_CK, '') + ';ssea2_search=ok';
  73. log('储存的cookie:' + cookie);
  74. let ret = request(MY_URL, {
  75. headers: {
  76. Cookie: cookie,
  77. }
  78. });
  79. if (/系统安全验证/.test(ret)) {
  80. let login = verifyLogin(KEY);
  81. cookie = login.cookie;
  82. if (cookie) {
  83. log(`本次成功过验证,cookie:${cookie}`);
  84. setItem(RULE_CK, cookie);
  85. } else {
  86. log(`本次自动过搜索验证失败,cookie:${cookie}`);
  87. }
  88. ret = login.html;
  89. // ret = request(MY_URL, {
  90. // headers: {
  91. // Cookie: cookie,
  92. // }
  93. // });
  94. }
  95. let d = [];
  96. let p = rule.一级.split(';');
  97. let arr = pdfa(ret, p[0]);
  98. arr.forEach(it => {
  99. d.push({
  100. title: pdfh(it, p[1]),
  101. pic_url: pdfh(it, p[2]),
  102. desc: pdfh(it, p[3]),
  103. url: pdfh(it, p[4]),
  104. content: '',
  105. });
  106. });
  107. setResult(d);
  108. }),
  109. }